let vm = new Vue({
    el: '.main-content',
    data: {
        username: '',
        password: ''
    },
    methods: {
        login: function () {
            axios({
                url: `/main/login`,
                params: {username: this.username, password: this.password}
            }).then(response => {
                if (!response.data.success) {
                    layer.msg("用户名或密码错误");
                } else {
                    //成功
                    location.href = `../../../html/index.html`;
                    //json转字符串
                    let loginUser = JSON.stringify(response.data);
                    sessionStorage.setItem("loginUser", loginUser)
                }
            }).catch(error => {
                //失败
                layer.msg("用户名或密码错误");
            })
        },


    }
});